<?php 
class MenuComponent extends Object {
    var $components = array('Session');
 
    function startup() {
 
        $userMenu = array();
        $generalMenu = array();
 
        $generalMenu[__('Home', true)] = '/';
 
        if(!$this->Session->check('Auth.User')) {
            $userMenu[__('Register', true)] = '/users/register';
            $userMenu[__('Login', true)] = '/users/login';
        }
        else {
            $userMenu[__('Logout', true)] = '/users/logout';
            $userMenu[__('Change', true)] = '/users/change';
        }
 
        //sample child item
        $parent = array();
        $parent[__('Child', true)] = '/';
        $generalMenu[__('Parent', true)] = $parent;
 
        $user = $this->Session->read('Auth.User');
 
 
        //menus arra
        $menus = array();
        $menus[__('General', true)] = $generalMenu;
        $menus[__('User ', true)] = $userMenu;
 
        $this->Session->write('Menu.main', $menus);
 
    }
}
?>